<?php



namespace App\Services\Member\Models;

use App\Services\Business\Models\Appraise;
use App\Services\Company\Models\Company;
use Illuminate\Database\Eloquent\Model;
use App\Services\Work\Models\Chat;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Role extends Model
{
    use HasFactory;


    protected $table = 'roles';

    protected $fillable = [
        'name', 'charge', 'expire_days', 'weight', 'description','thumb','company_id','title','is_forever_membership'
    ];


    public function privileges()
    {
        return $this->belongsToMany(Privilege::class, 'roles_privilege','role_id','privilege_id');
    }

    public function shop()
    {
        return $this->belongsTo(Company::class, 'company_id');
    }
    public function appraises()
    {
        return $this->morphMany(Appraise::class, 'appraiseable');
    }




}
